package com.sk.sourcecircle.activity.home.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.sk.sourcecircle.R;
import com.sk.sourcecircle.adapter.MoreJoinedAdapter;
import com.sk.sourcecircle.base.BaseActivity;
import com.sk.sourcecircle.entity.EventDetailsBean;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by sk on 2018/1/9.
 */

public class MoreJoinedActivity extends BaseActivity {
    @BindView(R.id.back)
    ImageView back;
    @BindView(R.id.data_ryc)
    RecyclerView dataRyc;

    private List<EventDetailsBean.DataBeanX.OrderBean> orderBeans = new ArrayList<>();

    @Override
    protected int getContentView() {
        return R.layout.activity_more_joined;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        dataRyc.setLayoutManager(new LinearLayoutManager(mContext));
        orderBeans = getIntent().getParcelableArrayListExtra("data");
        MoreJoinedAdapter adapter = new MoreJoinedAdapter(R.layout.item_pep,orderBeans);
        dataRyc.setAdapter(adapter);
        View emptyView = LayoutInflater.from(mContext).inflate(R.layout.empty_pep,dataRyc,false);
        adapter.setEmptyView(emptyView);
        adapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                Intent intent = new Intent(mContext,PersonDetailsActivity.class);
                intent.putExtra("id",orderBeans.get(position).getUser_id());
                startActivity(intent);
            }
        });

    }

    @OnClick(R.id.back)
    public void onViewClicked() {
        finish();
    }
}
